package org.huntaway.kindergarten.service.info;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.huntaway.kindergarten.manager.ClassInfoMng;
import org.huntaway.kindergarten.manager.TeacherGroupMng;
import org.huntaway.kindergarten.po.ClassInfo;
import org.huntaway.kindergarten.service.KindProcessor;
import org.huntaway.kindergarten.util.EnumUse;
import org.huntaway.kindergarten.util.GlobalCon;

public class ClassInfoService extends KindProcessor<ClassInfo> {
	public ClassInfoService() {
		super();
		baseMng = (ClassInfoMng) sm.getMng(GlobalCon.CLASS_INFO);
	}

	@Override
	public ClassInfo getObj() {
		return new ClassInfo();
	}

	public ActionForward addBegin(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward serBean = super
				.addBegin(mapping, form, request, response);
		// request.setAttribute("clazzLst",
		// ((ClassInfoMng)sm.getMng(GlobalCon.CLASS_INFO)).getClassInfo());
		request.setAttribute("tgLst", ((TeacherGroupMng) sm
				.getMng(GlobalCon.TEACHER_GROUP)).getTeacherGroup());
		return serBean;
	}

	public ActionForward addProcess(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward serBean = super.addProcess(mapping, form, request,
				response);
		dateManage.save(item);
		item.setIsuse(EnumUse.NO.getValue());
		return serBean;
	}

	public ActionForward editBegin(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward serBean = super.editBegin(mapping, form, request,
				response);
		request.setAttribute("tgLst", ((TeacherGroupMng) sm
				.getMng(GlobalCon.TEACHER_GROUP)).getTeacherGroup());
		return serBean;
	}
}
